<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Firkantregner</title>
</head>

<body>
<?php
	if(isset($_REQUEST["height"])) {
		$height=$_REQUEST["height"];
		$width=$_REQUEST["width"];
		$type=$_REQUEST["type"];
		
		if($type=="areal") {
			$res=$height * $width;
		} else{
			$res=2*$height + 2*$width;
		}
		
		echo"Resultat: $res";
	}




?>
	<form action="firkantregner.php"><br>
    	Højde: <input type="text" name="height"><br>
        Bredde: <input type="text" name="width"><br>
        <input type="radio" value="omkreds" name="type">Omkreds<br>
        <input type="radio" value="areal" name="type">Areal<br>
        <input type="submit" value="beregn">
    </form>

</body>
</html>